<?php

namespace app\model;

use app\utils\NumText;
use think\model\concern\SoftDelete;
class Article extends BaseModel
{
    use SoftDelete;
    // 设置表名
    protected $name = 'article';
    protected $deleteTime = 'delete_at';
    // 定义与分类的关联
    public function category()
    {
        return $this->belongsTo(ArticleCategory::class, 'category_id', 'id');
    }

    public function getStatusTextAttr($value, $data)
    {
        return NumText::statusText($data['status']??'');
    }
}
